package com.alogic.es.xscript;

import com.alogic.es.xscript.search.*;
import com.alogic.remote.xscript.ExecuteRequest;
import com.alogic.remote.xscript.ExecuteRequestDirectly;
import com.alogic.remote.xscript.auth.WithAuthorizedSignature;
import com.alogic.remote.xscript.auth.WithHttpBasicAuth;
import com.alogic.remote.xscript.auth.WithPassword;
import com.alogic.remote.xscript.auth.WithSignature;
import com.alogic.remote.xscript.auth.WithRSA;
import com.alogic.remote.xscript.request.*;
import com.alogic.remote.xscript.response.*;
import com.alogic.remote.xscript.util.*;
import com.alogic.xscript.Logiclet;
import com.alogic.xscript.Namespace;
import com.alogic.xscript.plugins.Get;

/**
 * Namespace
 *
 * @since 1.6.13.9 [20200824 duanyy]
 */
public class NS extends Namespace {
    public NS(String tag, Logiclet p) {
        super(tag, p);

        registerModule("es-call", ExecuteRequest.class);
        registerModule("es-call-direct", ExecuteRequestDirectly.class);

        registerModule("es-by-form", ByForm.class);
        registerModule("es-by-text", ByText.class);
        registerModule("es-by-json", ByJson.class);
        registerModule("es-set-content-type", SetContentType.class);
        registerModule("es-set-header", SetHeader.class);
        registerModule("es-auth-signature", WithSignature.class);
        registerModule("es-auth-password", WithPassword.class);
        registerModule("es-auth-rsa", WithRSA.class);
        registerModule("es-auth-signature2", WithAuthorizedSignature.class);
        registerModule("es-auth-basic", WithHttpBasicAuth.class);

        registerModule("es-discard", Discard.class);
        registerModule("es-as-json", AsJson.class);
        registerModule("es-as-text", AsText.class);
        registerModule("es-get-content-type", GetContentType.class);
        registerModule("es-get-header", GetHeader.class);
        registerModule("es-get-code", GetStatusCode.class);
        registerModule("es-get-reason",GetReason.class);
        registerModule("es-get-content-length", GetContentLength.class);

        registerModule("es-encode", Encoder.class);
        registerModule("es-decode", Decoder.class);
        registerModule("es-copy", Copy.class);
        registerModule("es-url-builder", UrlBuilder.class);
        registerModule("es-md5", MD5.class);

        registerModule("es-create", EsCommand.class,"java:///com/alogic/es/xscript/EsCreate.xml#" + this.getClass().getName());
        registerModule("es-drop", EsCommand.class,"java:///com/alogic/es/xscript/EsDrop.xml#" + this.getClass().getName());
        registerModule("es-cmd-request", EsCommandOnRequest.class);
        registerModule("es-cmd-response",EsCommandOnResponse.class);
        registerModule("es-doc-commit", EsCommandDoc.class,"java:///com/alogic/es/xscript/EsDocCommit.xml#" + this.getClass().getName());
        registerModule("es-doc-delete", EsCommandDoc.class,"java:///com/alogic/es/xscript/EsDocDelete.xml#" + this.getClass().getName());
        registerModule("es-doc-get", EsCommandDoc.class,"java:///com/alogic/es/xscript/EsDocGet.xml#" + this.getClass().getName());
        registerModule("es-count", EsCommand.class,"java:///com/alogic/es/xscript/EsDocCount.xml#" + this.getClass().getName());
        registerModule("es-search", EsCommand.class,"java:///com/alogic/es/xscript/EsDocSearch.xml#" + this.getClass().getName());
        registerModule("es-q-option", Get.class);
        registerModule("es-q", EsQuery.class);
        registerModule("es-q-term", EsTerm.class);
        registerModule("es-q-terms", EsTerms.class);
        registerModule("es-q-match", EsMatch.class);
        registerModule("es-q-bool", EsBool.class);
        registerModule("es-q-fuzzy", EsFuzzy.class);
        registerModule("es-q-script", EsScript.class);
        registerModule("es-q-wildcard", EsWildcard.class);
        registerModule("es-q-prefix",EsPrefix.class);
        registerModule("es-q-exists", EsExist.class);
        registerModule("es-q-phrase", EsPhrase.class);
        registerModule("es-q-string",EsString.class);
        registerModule("es-q-id", EsId.class);
    }
}
